package scau.erps.view.base;

import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import scau.erps.app.Erps;
import scau.erps.entity.Store;

/**
 * 原材料仓库面板
 * @author outsider
 *
 */
public class StorePanel extends JPanel {
	private static final long serialVersionUID = 1L;
	private JLabel m1,m2,m3,m4;	
	public StorePanel(){		
		JPanel	storePanel = new JPanel();		
		storePanel.setPreferredSize(new Dimension(150,180));
		storePanel.setLayout(new GridLayout(4,2));
		storePanel.setBorder(BorderFactory.createTitledBorder("仓库"));
		JLabel m1Label = new JLabel("M1:");
		JLabel m2Label = new JLabel("M2:");
		JLabel m3Label = new JLabel("M3:");
		JLabel m4Label = new JLabel("M4:");
		m1 = new JLabel("0");
		m2 = new JLabel("0");
		m3  = new JLabel("0");
		m4  = new JLabel("0");
		storePanel.add(m1Label);
		storePanel.add(m1);
		storePanel.add(m2Label);
		storePanel.add(m2);
		storePanel.add(m3Label);
		storePanel.add(m3);
		storePanel.add(m4Label);
		storePanel.add(m4);;
		this.add(storePanel);
	}
	public void setStoreData(){
		Store store = Erps.getStore();
		m1.setText(""+store.getM1());
		m2.setText(""+store.getM2());
		m3.setText(""+store.getM3());
		m4.setText(""+store.getM4());
	}

}
